home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Gekikoh Dennoh Club 2
/
Gekikoh Dennoh Club Vol. 2 (Japan).7z
/
Gekikoh Dennoh Club Vol. 2 (Japan) (Track 01).bin
/
kowin
/
util
/
sclock.lzh
/
sclock.c
next >
Wrap
C/C++ Source or Header
|
1993-02-17
|
2KB
|
81 lines
/* 1993 H.Ogasawara (COR.) */
/* 時計のサンプルプログラム */
/* 非常にシンプルな時計です。スケルトンプログラムとしてどうぞ。 */
#include <corlib.h>
/**/
#define WAIT 40 /*何イベント毎に時刻をチェックするか*/
/**/
#define SPOSX 4 /*時刻の表示位置*/
#define SPOSY 2
#define SATTR AttrDefault /*表示文字の色*/
#define SFONT 12 /*表示文字のサイズ*/
/**/ /*上記のパラメータからウィンドウサイズを計算する*/
#define HSIZE (SFONT*8/2+SPOSX*2)
#define VSIZE (SFONT+SPOSY*2)
Exec( wp, info )
WindowID wp;
EventInfo *info;
{
static DrawBuf dbuf[2];
static char str[10];
static unsigned short count= 1;
switch( info->option ){
case EventInterval:
/* EventInterval 内での処理は最小限にする */
if( !--count ){
static int bin;
count= WAIT;
if( TIMEGET() != bin ){
TIMEASC( TIMEBIN( bin= TIMEGET() ), str );
WindowDraw( wp, dbuf+1, 1 );
return TRUE;
}
}
break;
case EventRedraw:
WindowDraw( wp, dbuf, 2 );
return TRUE;
case EventOpen:
/* あらかじめ DrawBuf の設定を行なっておく */
DrawSetClear( dbuf, 1 );
DrawSetSymbol( dbuf+1, SPOSX, SPOSY, str, SATTR, SFONT );
/* EventIntervalを取る */
WindowSetEventAttr( wp, EventAttrDefault|EventIntervalON );
WindowRedraw( wp );
return TRUE;
case EventClose:
WindowClose( wp );
WindowConnectionClose();
return TRUE;
case EventMouseSwitch:
if( info->LeftON ){
SendData( wp, info, UserString, str );
return TRUE;
}
}
return FALSE;
}
/* 標準的なメイン関数 */
WindowMain( argc, argv )
char **argv;
{
int x= 100, y= 100;
AnalyzeArgs( argc, argv, &x, &y, NULL, NULL );
WindowTitleOpen( x, y, HSIZE, VSIZE, NULL, "ゥ", Close|Push, Exec );
}